package com.common.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Data
@TableName(value = "bl_article")
public class Article {

    @TableId(type = IdType.AUTO)
    Long articleId;

    @NotEmpty(message = "文章标题不能为空")
    @Size(max = 50, message = "文章标题不能超过50个字")
    @ApiModelProperty(value = "文章标题")
    String title;

    @ApiModelProperty(value = "文章简介")
    @Size(max = 300, message = "简介不能超过150个字")
    String contentShort;

    @NotEmpty(message = "文章内容不能为空")
    @ApiModelProperty(value = "文章内容")
    String content;

    @ApiModelProperty(value = "状态 [0 => 正常, 1 => 隐藏]")
    Integer status;

    @ApiModelProperty(value = "评论 [0 => 开启 1 => 关闭]")
    Byte commentDisabled;

    @ApiModelProperty(value = "文章首图")
    String firstPicture;

    @ApiModelProperty(value = "所属分类")
    Long categoryId;

    @ApiModelProperty(value = "文章标签")
    String tags;

    @ApiModelProperty(value = "阅读数")
    Integer readNumber;

    @ApiModelProperty(value = "点赞数")
    Integer likeNumber;

    @ApiModelProperty(value = "收藏数")
    Integer favoriteNumber;

    @NotNull(message = "文章发布时间不能为空")
    @ApiModelProperty(value = "发布时间")
    Integer createTime;

    @ApiModelProperty(value = "更新时间")
    Integer updateTime;

    @ApiModelProperty(value = "用户ID")
    Long userId;

    @TableField(exist = false)
    User user;

    @TableField(exist = false)
    Category category;
}
